#include <xscript/xabstractsyntaxtreevisitor.h>

void XAbstractSyntaxTreeVisitor::visit(std::shared_ptr<XAbstractSyntaxTree> tree) {
    if (tree->getToken()->asBoolean())
        visitBoolean(tree);
    else if (tree->getToken()->asInteger())
        visitInt(tree);
    else if (tree->getToken()->asFloat())
        visitFloat(tree);
    else if (tree->getToken()->asString())
        visitString(tree);
    else if (tree->getToken()->asVariable())
        visitString(tree);
    else if (tree->getName() == L">")
        visitGreate(tree);
    else if (tree->getName() == L">=")
        visitGreateOrEqual(tree);
    else if (tree->getName() == L"<")
        visitLess(tree);
    else if (tree->getName() == L"<=")
        visitLessOrEqual(tree);
    else if (tree->getName() == L"and")
        visitAnd(tree);
    else if (tree->getName() == L"or")
        visitOr(tree);
    else if (tree->getName() == L"not")
        visitNot(tree);
    else if (tree->getName() == L"block")
        visitNot(tree);
    else if (tree->getName() == L"let")
        visitLet(tree);
    else if (tree->getName() == L"set")
        visitSet(tree);
    else if (tree->getName() == L"if")
        visitIf(tree);
    else if (tree->getName() == L"else")
        visitElse(tree);
    else if (tree->getName() == L"print")
        visitPrint(tree);
    else if (tree->getName() == L"return")
        visitReturn(tree);
    else if (tree->getName() == L"break")
        visitBreak(tree);
    else if (tree->getName() == L"for")
        visitFor(tree);
    else if (tree->getName() == L"while")
        visitWhile(tree);
    else if (tree->getName() == L"function")
        visitWhile(tree);
    else
        print(std::wcout, "not registered abstract syntax tree type:", tree->getName());
}

void XAbstractSyntaxTreeVisitor::visitInt(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitString(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitBoolean(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitFloat(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitVariable(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitValue(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitGreate(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitGreateOrEqual(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitLess(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitLessOrEqual(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitEqual(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitNot(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitAnd(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitOr(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitBlock(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitIf(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitElse(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitFor(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitWhile(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitFunction(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitPrint(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitLet(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitSet(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitBreak(std::shared_ptr<XAbstractSyntaxTree> tree) {}

void XAbstractSyntaxTreeVisitor::visitReturn(std::shared_ptr<XAbstractSyntaxTree> tree) {}
